package com.wenyang.service.impl;

import com.wenyang.dao.CarouselDao;
import com.wenyang.entity.TabCarousel;
import com.wenyang.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class CarouselServiceImpl implements CarouselService {

    @Autowired
    private CarouselDao carouselDao;

    @Override
    public List<TabCarousel> findAllCarousel() {
        String url = "https://20240416-wenyangfile.oss-cn-beijing.aliyuncs.com/";
        List<TabCarousel> tabCarousels = new ArrayList<>();
        List<TabCarousel> allCarousel = carouselDao.findAllCarousel();
        for (TabCarousel tabCarousel : allCarousel) {
            tabCarousel.setCpath(url+tabCarousel.getCpath());
            tabCarousels.add(tabCarousel);
        }
        return tabCarousels;
    }
}
